<?php
$coltp3Esp = '"'.$tip3Nombre[3][2].'"';

switch($db->driver)
{
	case 'mssql':
	{
		$isql = '';
	}break;
	case 'postgres':
	case 'postgres7':
	case 'oci8':
	case 'oracle':
	{
		$isql = "select
					b.RADI_NUME_RADI as IDT_Numero_Radicado
					,b.RADI_PATH as HID_RADI_PATH
					,$sqlFecha as DAT_Fecha_Transaccion
					,b.RADI_NUME_RADI as HID_RADI_NUME_RADI
					,h.HIST_OBSE AS Comentario
					,b.RA_ASUN  as Asunto
					,c.SGD_TPR_DESCRIP as Tipo_Documento
					,(select usActu.usua_nomb from usuario usActu where usActu.usua_codi=b.radi_usua_actu and usActu.depe_codi=b.radi_depe_actu) AS Usuario_Actual
					,ttr.SGD_TTR_DESCRIP AS Tipo_Transaccion
					,b.RADI_LEIDO AS HID_RADI_LEIDO
					,b.RADI_NUME_HOJA AS HID_RADI_NUME_HOJA
					,b.CARP_PER AS HID_CARP_PER
					,b.CARP_CODI AS HID_CARP_CODI
					,b.SGD_EANU_CODIGO AS HID_EANU_CODIGO
					,b.RADI_NUME_DERI AS HID_RADI_NUME_DERI
					,b.RADI_TIPO_DERI AS HID_RADI_TIPO_DERI
			 from			 
			 HIST_EVENTOS h,
			 USUARIO us,
			 SGD_TTR_TRANSACCION ttr,
			 radicado b LEFT JOIN SGD_TPR_TPDCUMENTO c ON b.tdoc_codi=c.sgd_tpr_codigo
		 where
			h.USUA_DOC=us.USUA_DOC
			AND h.SGD_TTR_CODIGO=ttr.SGD_TTR_CODIGO
			AND b.RADI_NUME_RADI=h.RADI_NUME_RADI
			$cons_codigo
			AND h.USUA_DOC= $usua_doc
			AND h.HIST_FECH between $fecha_ini AND $fecha_fin
			AND b.RADI_NUME_RADI is not null 
			$whereUsuario $whereFiltro
			order by $order $orderTipo";
	}break;
	
}
?>
